<?php
//交易支付通知

$param = file_get_contents('php://input');
file_put_contents('payment_notify.json', $param);

$param = json_decode($param, true);

if (!empty($param['msg'])) {

    $msg = $param['msg'];
    $msg = json_decode($msg, true);

    $out_order_no = $msg['out_order_no'];
    $total_amount = $msg['total_amount']; //总金额
    $pay_channel = $msg['pay_channel']; //支付渠道
    $order_no = $msg['order_no'];
    if ($msg['status'] == "SUCCESS") {
        echo json_encode([
            'err_no' => 0,
            'err_tips' => 'success',

        ]);
    } else {
        echo json_encode([
            'err_no' => 1,
            'err_tips' => 'system error',

        ]);
    }

    // var_dump($msg['goods'][0]['goods_id']);
    // exit;

} else {
    //
    // echo json_encode([
    //     'err_no' => 1,
    //     'err_tips' => 'success',

    // ]);
}

exit;